/**
int f(int n)
{
    int ans=0;

    while(n>0)
    {
        ans+=n%10;
        n/=10;
    }

    return ans;
}
*/
int f(int n)
{
    return (n<10)?n:f(n/10)+(n%10);
}
int main()
{
    printf("%d\n",0==f(0));
    printf("%d\n",1==f(1));
    printf("%d\n",6==f(123));

    return 0;
}
